package list;

import java.util.ArrayList;

public class ThreadSafe {
    public static void main(String[] args) {
        for (int i = 0; i < 100; i++){
            new Thread(()->{
                new ThreadSafe().method1(10);
            }).start();
        }

    }
    public final void method1(int loopNumber) {
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < loopNumber; i++) {
            method2(list);
        }
        System.out.println(list);
    }
    private void method2(ArrayList<String> list) {
        list.add("1");
    }

}
